package com.jiulan.hearthearing.ui.home.adapter;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiulan.hearthearing.R;
import com.jiulan.hearthearing.ui.home.model.HomeModel;
import com.shehuan.niv.NiceImageView;

import java.util.List;

public class HomeCourseAdapter extends BaseQuickAdapter<HomeModel.DataBean.BestClassBean, BaseViewHolder> {

    public HomeCourseAdapter(List<HomeModel.DataBean.BestClassBean> data) {
        super(R.layout.item_home_kecheng, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeModel.DataBean.BestClassBean item) {
        NiceImageView nivPic = helper.getView(R.id.nivPic);
        Glide.with(mContext).asBitmap().load(item.getImage()).override(170, 75).centerCrop().into(nivPic);
        Glide.with(mContext).load(item.getImage()).into(nivPic);
        helper.setText(R.id.tvCourseTitle, item.getTitle());
        helper.setText(R.id.tvCourseContent, item.getShort_title());
        helper.setText(R.id.tvSignNum, String.valueOf(item.getBuy_num()) + "人已报名");
        helper.addOnClickListener(R.id.tvSign);
    }
}
